//CatsFreezenades

Actor BluePlasmaFireXL : BluePlasmaFire
{

  +NoGravity
  RenderStyle Add
  Scale 2.5
  Alpha 0.9
  Speed 0
  States
  {
  Spawn:
  Death:
    FIR5 ABCDEFGHIJKLMNOP 1 Bright// A_FadeOut(0.04)
	//PLAF ABCDEFGHIJKLMNOPQ 1 Bright
    Stop
  }
}

ACTOR Freezenades : BrutalWeapon
{
	Weapon.AmmoUse1 1
	Weapon.AmmoGive1 0
	Weapon.SelectionOrder 99999
	Weapon.AmmoType1 "FreezenadeAmmo"
	Weapon.PreferredSkin "Fist Marine"
	Obituary "%o was shreded by %k's grenade."
    AttackSound "None"
    Inventory.PickupSound "AmmoAPIN"
	Inventory.Pickupmessage "You got a Freezenade!  (Slot 9)"
	Inventory.ForbiddenTo Sorcerer, Paladin, Corvus
    +WEAPON.NOAUTOAIM
    +WEAPON.NOALERT
	+WEAPON.NOAUTOFIRE
	//+INVENTORY.UNDROPPABLE
    Scale 0.3
	States
	{
	
	Ready:
	ReadyLoop:
	Ready3:
	    TNT1 A 0
		TNT1 A 0 A_GunFlash
		TNT1 A 0 A_JumpIfInventory("FreezenadeAmmo", 1, 1)
		
		Goto NoGrenades
		FGHO AB 1
		Goto Steady
		
	Steady:
		FGHO A 3 A_WeaponReady
		TNT1 A 0 A_JumpIfInventory("TossGrenade",1,"TossGrenade")
		TNT1 A 0 A_JumpIfInventory("Kicking",1,"DoKick")
        TNT1 A 0 A_JumpIfInventory("Taunting",1,"Taunt")
		TNT1 A 0 A_JumpIfInventory("Salute1", 1, "Salute")
		TNT1 A 0 A_JumpIfInventory("Salute2", 1, "Salute")
		
		FGHO B 3 A_WeaponReady
		TNT1 A 0 A_JumpIfInventory("TossGrenade",1,"TossGrenade")
		TNT1 A 0 A_JumpIfInventory("Kicking",1,"DoKick")
        TNT1 A 0 A_JumpIfInventory("Taunting",1,"Taunt")
		TNT1 A 0 A_JumpIfInventory("Salute1", 1, "Salute")
		TNT1 A 0 A_JumpIfInventory("Salute2", 1, "Salute")
		
		FGHO C 3 A_WeaponReady
		TNT1 A 0 A_JumpIfInventory("TossGrenade",1,"TossGrenade")
		TNT1 A 0 A_JumpIfInventory("Kicking",1,"DoKick")
        TNT1 A 0 A_JumpIfInventory("Taunting",1,"Taunt")
		TNT1 A 0 A_JumpIfInventory("Salute1", 1, "Salute")
		TNT1 A 0 A_JumpIfInventory("Salute2", 1, "Salute")
		
		FGHO B 3 A_WeaponReady
		TNT1 A 0 A_JumpIfInventory("TossGrenade",1,"TossGrenade")
		TNT1 A 0 A_JumpIfInventory("Kicking",1,"DoKick")
        TNT1 A 0 A_JumpIfInventory("Taunting",1,"Taunt")
		TNT1 A 0 A_JumpIfInventory("Salute1", 1, "Salute")
		TNT1 A 0 A_JumpIfInventory("Salute2", 1, "Salute")
		Loop
		
	
	NoGrenades:
		TNT1 A 1 A_WeaponReady
		Goto Ready
	
	Deselect:
		TNT1 A 0
		TNT1 A 0 A_TakeInventory("HasFreezerWeapon", 1)
		TNT1 A 0 A_JumpIfInventory("FiredGrenade", 1, "DropGrenade")
		TNT1 A 1 A_Lower
		Wait
	
	DropGrenade:
		TNT1 A 0
		TNT1 A 0 A_TakeInventory("FiredGrenade", 1)
		TNT1 A 0 A_FireCustomMissile("HandGrenadeDroped", random(-2,2), 1, 0, 0, 0, 0)
		Goto Deselect
		
	Select:
		TNT1 A 0 A_Giveinventory("GoSpecial",1)

		SelectAnimation:
		TNT1 A 1 A_Raise
		TNT1 AAAAAA 0 A_Raise
		FGDW A 1
	    FGDW A 0 A_JumpIfInventory("GoFatality", 1, "Steady")
        FGDW ABC 1
        FGDW A 0 A_GunFlash
		Goto Ready	
		
	Fire:
	    FGTH ABCD 1
		TNT1 A 0 A_GiveInventory("FiredGrenade", 1)
		TNT1 A 0 A_Giveinventory("HasFreezerWeapon",1)
		TNT1 A 0 A_PLaySound ("GRNPIN")
		FGTH EEFG 1
		
	Hold:
	    TNT1 A 1
		TNT1 A 1 A_Refire
		TNT1 A 0 A_PLaySound ("GRNTOSS")
		GRTH HI 1
		TNT1 A 0 A_FireCustomMissile("Freezenade", random(-2,2), 1, 0, 0, 0, 0)
	    TNT1 A 0 A_TakeInventory("FiredGrenade", 1)
		GRTH JKLM 1
		TNT1 A 3 
		Goto Ready	
	
	AltFire:
		TNT1 A 0
		TNT1 A 0 A_JumpIfInventory("FreezenadeAmmo", 1, 1)
		Goto NoGrenades
		TNT1 A 0 A_TakeInventory("FreezenadeAmmo", 1)
	    FGTH ABCD 1
		TNT1 A 0 A_GiveInventory("FiredGrenade", 1)
		TNT1 A 0 A_Giveinventory("HasFreezerWeapon",1)
		TNT1 A 0 A_PLaySound ("GRNPIN")
		FGTH EEFG 1
		
	AltHold:
	    TNT1 A 1
		TNT1 A 1 A_Refire
		TNT1 A 0 A_PLaySound ("GRNTOSS")
		GRTH HI 1
		TNT1 A 0 A_FireCustomMissile("Freezenade", 0, 1, 0, 0, 0, 0)
	    TNT1 A 0 A_TakeInventory("FiredGrenade", 1)
		GRTH JKLM 1
		TNT1 A 3 
		Goto Ready		
 	
	Spawn:
		FGND H -1
		Stop	
	}
}


ACTOR Freezenade
{
	Radius 4
	Height 4
	Projectile
	Speed 30
    Damage (random (2, 2))
    Gravity 0.7
	Scale 0.4
	Projectile
	+MISSILE
    -NOGRAVITY
    -BLOODSPLATTER
	-EXTREMEDEATH
	+EXPLODEONWATER
	+SKYEXPLODE
	+BOUNCEONFLOORS
	+BOUNCEONWALLS
	+BOUNCEONCEILINGS
	-NOTELEPORT
	+THRUSPECIES
	Species "Marines"
	BounceFactor 0.5
	WallBounceFactor 0.25
    Health 5
    SeeSound "GRNBNCE"
	DeathSound "none"
	Obituary "%o ate %k freezenade."
	States
	{
	Spawn:
		FGND ABCDEFG 2
		TNT1 A 0 A_GiveInventory("GrenadeTime", 1)
		TNT1 A 0 A_JumpIfInventory("GrenadeTime", 3, "Explode")
		Loop
	Death:
		TNT1 A 0
		TNT1 A 0 A_AlertMonsters(200)
	    FGND K 16
		TNT1 A 0 A_GiveInventory("GrenadeTime", 1)
		TNT1 A 0 A_JumpIfInventory("GrenadeTime", 3, "Explode")
		Loop
		
		
		
	Explode:
		TNT1 A 0 A_NoBlocking
		TNT1 A 0 A_TakeFromTarget("HasFreezerWeapon",1) 
		TNT1 A 0 A_SpawnItemEx("FreezenadeExplosion", 0, 0 ,2.5)
		TNT1 AA 0
		Stop
	}
}

ACTOR FreezenadeAmmo : Ammo
{
	Game Doom
	Inventory.PickupMessage "Picked up a Freezenade."
	Inventory.Amount 1
	Inventory.MaxAmount 10
	Ammo.BackpackAmount 5
	Ammo.BackpackMaxAmount 20
	Inventory.Icon "FZGRN"
	Scale 0.3
	States
	{
	Spawn:
		FGND H -1
		Stop
	Pickup:
		TNT1 A 0 A_GiveInventory("FreezenadeAmmo", 1)
		TNT1 A 0 A_JumpIfInventory("Freezenades", 1, 1)
		TNT1 A 0 A_GiveInventory("Freezenades", 1)
		Stop
	}
}